package com.example.it.model;

import com.example.it.base.BaseModel;
import com.example.it.base.Baseobserver;
import com.example.it.bean.ChapterTabBean;
import com.example.it.not.ApiSercie;
import com.example.it.not.HttpUlist;
import com.example.it.not.RxUlist;

import io.reactivex.Observable;

public class TabModel extends BaseModel {
    public void addModel(TabCallBack callBack){
        ApiSercie apiServer = new HttpUlist().getApiServer(ApiSercie.sWanUrl, ApiSercie.class);
        Observable<ChapterTabBean> chapterTab = apiServer.getChapterTab();
        chapterTab.compose(RxUlist.RxobservableTransformer())
                .subscribe(new Baseobserver<ChapterTabBean>(this) {
                    @Override
                    protected void onSuccess(ChapterTabBean chapterTabBean) {
                        callBack.onSuccess(chapterTabBean);
                    }

                    @Override
                    protected void onFail(String message) {
                        callBack.onFali(message);
                    }
                });
    }
}
